package com.sky.controller.backstage;

import com.sky.dto.*;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.service.ArticleService;
import com.sky.service.BackstageArticleService;
import com.sky.service.BackstageCommentService;
import com.sky.vo.ArticleInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 贾晓晨
 * @version 1.0
 */
@RestController
@RequestMapping("/backstage/comment")
@Slf4j
@Api(tags = "后台评论管理接口")
public class BackstageCommentController {
    @Autowired
    private BackstageCommentService backstageCommentService;

    @GetMapping
    @ApiOperation("获取评论信息")
    public Result<PageResult> getCommentList(BackstageCommentQueryDTO backstageCommentQueryDTO) {
        PageResult articleInfoList = backstageCommentService.getCommentList(backstageCommentQueryDTO);
        return Result.success(articleInfoList);
    }

    @DeleteMapping
    @ApiOperation("删除评论")
    public Result deleteComment(@RequestBody List<Integer> ids) {
        backstageCommentService.deleteCommentByCommentId(ids);
        return Result.success("删除成功");
    }
}
